<?php
/**
 * notes groupindex view
 *
 * @package    FinalsClub
 * @subpackage notes
 * @author     Colin Hom
 * @description  Lists all courses for a group, for purpose of displaying notes
 */

use_helper('Summary');
use_helper('Pagination', 'Summary');
slot('groupsNav', 'active'); 
?>
<div class="courses" id="wrapper">
	<?php include_partial('global/systemMessages') ?>
	<div id="content">
		<div id="main">			
			<div class="main-heading">
				<h1><?= $group->getName() ?></h1>
			</div>
			<?php include_partial('groups/subnav',array("group_id" => $group_id, "current" => "Readings")) ?>
			
			<div class="filter-links with-icon">
				<!--<form id="select-semester" method="post" action="">
				<fieldset>
				<label>Class:</label>
				<select>
				</select>
				</fieldset>
				</form>
				-->
				
		
				<ul class="book inline">
				<li>Group Readings</li>
				</ul>
				
				<div style="float:right;">
				<?php echo link_to('Create a Summary &#xBB;', 'summaries/new?group_id='.$group->getId())?>
				</div>
			</div>
			
			<!-- moved this bit (listing the courses for the group) to the courses controller... -->

			<ul class="courses-list">
				<?php foreach($summaries as $summary):?>
				<li>
					<h3>
						<?php echo $summary->getTitle()?> : <?php echo link_to($summary->getSubTitle(),'summaries/show?id='.$summary->getId())?>
					</h3>
					<p class="date"><?php echo $summary->getCreatedAt('M d, Y')?></p>
					
					<!--<a class="btn_share" href="#">Shared with the school</a>-->
					
					<div class="details">
					<p class="related-users">
					<strong>Note Taker: </strong>
						<?php echo render_profile_link($summary->getUser())?>
					</p>
						<p><?php echo render_summary_text($summary)?></p>
						
						<!--<p class="stars two">
						</p>
						-->
					<div class="clearer"/>
					</div>
				</li>
				<?php endforeach?>
			
				<li class="last">
				</li>
			</ul>
			<div class="pager">
			
			</div>
		</div>
		<div id="sidebar">		
			<?php include_component('group_members', 'pending', array('group_id' => $group->getId()))?>
			<?php include_component('group_members', 'list', array('group_id' => $group->getId()))?>
		</div>
	</div>

</div>

<script>
	$(document).ready(function(){
		$(".share").click(function(){
			var options = {
				data: {state: this.id},
				success:  function(response){ alert(response)},
			}
			$("#" + this.name).ajaxSubmit(options);	
		});
		
		$(".share").confirm({
			timeout:3000,
			dialogShow:'fadeIn',
			dialogSpeed:'slow',
			msg: "Change course materials permissions?",
			buttons: {
				wrapper:'<button></button>',
				separator:'  '
		  }  

			
		});
		
	});
	
</script>